//
//  CommentOrderViewController.m
//  SXH
//
//  Created by Ryan on 16/7/15.
//  Copyright © 2016年 lyss. All rights reserved.
//

#import "CommentOrderViewController.h"
#import "CommonService.h"
@interface CommentOrderViewController ()

@end

@implementation CommentOrderViewController

- (void)viewDidLoad {
//    self.needNavigation = YES;
    [super viewDidLoad];
    self.submitBtn.layer.cornerRadius = 8;
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.starView.scorePercent = 0.2;
    self.title = @"订单评价";
}

- (IBAction)submitClick:(id)sender
{
    CommonService *service = [[CommonService alloc]init];
    NSDictionary * parm = @{@"order_id":self.order_id,
                            @"star":[NSString stringWithFormat:@"%.0f",round(self.starView.scorePercent*5)],
                            @"content":self.contentTextView.text};
    [service getNetWorkData:parm Path:ORDERCOMMENT Successed:^(id entity) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"评价成功" message:@"评价成功返回订单列表" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
        [alert show];

    } Failed:^(NSInteger errorCode, NSString *message) {
        [self showTips:message];
    }];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    OrderHasPaidViewController *mvc = self.pre_vc;
    [mvc getOrderData:1 RefreshView:nil];
    [self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)doback:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}

@end
